home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Ant Movie Catalog 3.5.0.2 / amc_install.exe / {app} / Scripts / film.sarnet.pl.ifs < prev    next >
Text File  |  2005-03-13  |  23KB  |  589 lines

  1. (***************************************************
  2.  
  3. Ant Movie Catalog importation script
  4. www.antp.be/software/moviecatalog/
  5.  
  6. [Infos]
  7. Authors=Goster
  8. Title=film.sarnet.pl
  9. Description=film.sarnet.pl info & picture
  10. Site=http://www.film.sarnet.pl/
  11. Language=PL
  12. Version=
  13. Requires=3.5.0
  14. Comments= Movie information & picture importation
  15. License=This program is free software; you can redistribute it and/or modify it under the  terms of the GNU General Public License as published by the Free Software Foundation;  either version 2 of the License, or (at your option) any later version. |
  16. GetInfo=1
  17.  
  18. [Options]
  19.  
  20. ***************************************************)
  21.  
  22. program Megafilm;
  23. var
  24.   MovieName: string;
  25.   Link: string;
  26.   pozycja, pozycja2, pozycja3: integer;
  27.   cover, nocover: boolean;
  28.  
  29. function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
  30.   var
  31.   i: Integer;
  32.   begin
  33.   result := -1;
  34.   if StartAt < 0 then
  35.     StartAt := 0;
  36.   for i := StartAt to List.Count-1 do
  37.     if Pos(Pattern, List.GetString(i)) <> 0 then
  38.       begin
  39.       result := i;
  40.       Break;
  41.       end;
  42.   end;
  43.  
  44. procedure DecodeHTML(var Value: String);
  45.   var
  46.   FullValue, CharCode: String;
  47.   Counter: Integer;
  48.   begin
  49.   if Value <> '' then begin
  50.     FullValue := '';
  51.     Counter := 1;
  52.     repeat
  53.       if StrGet(Value, Counter) <> '&' then
  54.         begin
  55.         CharCode := copy(Value, Counter, 1);
  56.         case CharCode of
  57.           '▒': CharCode := '╣';
  58.           '╢': CharCode := '£';
  59.           'í': CharCode := 'Ñ';
  60.           '╝': CharCode := 'ƒ';
  61.           'ª': CharCode := 'î';
  62.           '¼': CharCode := 'Å';
  63.           end;
  64.         FullValue := FullValue + CharCode;
  65.         Counter := Counter + 1;
  66.         end
  67.       else
  68.         begin
  69.         CharCode := copy(Value, Counter, 7);
  70.         case CharCode of
  71.           'ą': FullValue := FullValue + '╣';
  72.           'ć': FullValue := FullValue + 'µ';
  73.           'ę': FullValue := FullValue + 'Ω';
  74.           'ł': FullValue := FullValue + '│';
  75.           'ń': FullValue := FullValue + '±';
  76.           'ó': FullValue := FullValue + '≤';
  77.           'ś': FullValue := FullValue + '£';
  78.           'ź': FullValue := FullValue + 'ƒ';
  79.           'ż': FullValue := FullValue + '┐';
  80.           'Ą': FullValue := FullValue + 'Ñ';
  81.           'Ć': FullValue := FullValue + '╞';
  82.           'Ę': FullValue := FullValue + '╩';
  83.           'Ł': FullValue := FullValue + 'ú';
  84.           'Ń': FullValue := FullValue + '╤';
  85.           'Ó': FullValue := FullValue + '╙';
  86.           'Ś': FullValue := FullValue + 'î';
  87.           'Ź': FullValue := FullValue + 'Å';
  88.           'Ż': FullValue := FullValue + '»';
  89.           'Š': FullValue := FullValue + ' ';
  90.           'š': FullValue := FullValue + 'í';
  91.           'Ţ': FullValue := FullValue + 'í';
  92.           'ţ': FullValue := FullValue + 'ú';
  93.           'Ť': FullValue := FullValue + 'ñ';
  94.           'ť': FullValue := FullValue + 'Ñ';
  95.           'Ŧ': FullValue := FullValue + 'î';
  96.           'ŧ': FullValue := FullValue + 'º';
  97.           'Ũ': FullValue := FullValue + '¿';
  98.           'ũ': FullValue := FullValue + '⌐';
  99.           'Ű': FullValue := FullValue + '¬';
  100.           'ű': FullValue := FullValue + '½';
  101.           'Ų': FullValue := FullValue + '¼';
  102.           'ų': FullValue := FullValue + '¡';
  103.           'Ŵ': FullValue := FullValue + '«';
  104.           'ŵ': FullValue := FullValue + '»';
  105.           'Ŷ': FullValue := FullValue + '░';
  106.           'ŷ': FullValue := FullValue + '▒';
  107.           'Ÿ': FullValue := FullValue + '▓';
  108.           'ƀ': FullValue := FullValue + '┤';
  109.           'Ɓ': FullValue := FullValue + '╡';
  110.           'Ƃ': FullValue := FullValue + '╢';
  111.           'ƃ': FullValue := FullValue + '╖';
  112.           'Ƅ': FullValue := FullValue + '╕';
  113.           'ƅ': FullValue := FullValue + '╣';
  114.           'Ɔ': FullValue := FullValue + '║';
  115.           'Ƈ': FullValue := FullValue + '╗';
  116.           'ƈ': FullValue := FullValue + '╝';
  117.           'Ɖ': FullValue := FullValue + '╜';
  118.           'Ɛ': FullValue := FullValue + '╛';
  119.           'Ƒ': FullValue := FullValue + '┐';
  120.           'ƒ': FullValue := FullValue + '└';
  121.           'Ɠ': FullValue := FullValue + '┴';
  122.           'Ɣ': FullValue := FullValue + '┬';
  123.           'ƕ': FullValue := FullValue + '├';
  124.           'Ɩ': FullValue := FullValue + '─';
  125.           'Ɨ': FullValue := FullValue + '┼';
  126.           'Ƙ': FullValue := FullValue + '╞';
  127.           'ƙ': FullValue := FullValue + '╟';
  128.           'Ȁ': FullValue := FullValue + '╚';
  129.           'ȁ': FullValue := FullValue + '╔';
  130.           'Ȃ': FullValue := FullValue + '╩';
  131.           'ȃ': FullValue := FullValue + '╦';
  132.           'Ȅ': FullValue := FullValue + '╠';
  133.           'ȅ': FullValue := FullValue + '═';
  134.           'Ȇ': FullValue := FullValue + '╬';
  135.           'ȇ': FullValue := FullValue + '╧';
  136.           'Ȉ': FullValue := FullValue + '╨';
  137.           'ȉ': FullValue := FullValue + '╤';
  138.           'Ȑ': FullValue := FullValue + '╥';
  139.           'ȑ': FullValue := FullValue + '╙';
  140.           'Ȓ': FullValue := FullValue + '╘';
  141.           'ȓ': FullValue := FullValue + '╒';
  142.           'Ȕ': FullValue := FullValue + '╓';
  143.           'ȕ': FullValue := FullValue + '╫';
  144.           'Ȗ': FullValue := FullValue + '╪';
  145.           'ȗ': FullValue := FullValue + '┘';
  146.           'Ș': FullValue := FullValue + '┌';
  147.           'ș': FullValue := FullValue + '█';
  148.           'Ƞ': FullValue := FullValue + '▄';
  149.           'ȡ': FullValue := FullValue + '▌';
  150.           'Ȣ': FullValue := FullValue + '▐';
  151.           'ȣ': FullValue := FullValue + '▀';
  152.           'Ȥ': FullValue := FullValue + 'α';
  153.           'ȥ': FullValue := FullValue + 'ß';
  154.           'Ȧ': FullValue := FullValue + 'Γ';
  155.           'ȧ': FullValue := FullValue + 'π';
  156.           'Ȩ': FullValue := FullValue + 'Σ';
  157.           'ȩ': FullValue := FullValue + 'σ';
  158.           'Ȱ': FullValue := FullValue + 'µ';
  159.           'ȱ': FullValue := FullValue + 'τ';
  160.           'Ȳ': FullValue := FullValue + 'Φ';
  161.           'ȳ': FullValue := FullValue + 'Θ';
  162.           'ȴ': FullValue := FullValue + 'Ω';
  163.           'ȵ': FullValue := FullValue + 'δ';
  164.           'ȶ': FullValue := FullValue + '∞';
  165.           'ȷ': FullValue := FullValue + 'φ';
  166.           'ȸ': FullValue := FullValue + 'ε';
  167.           'ȹ': FullValue := FullValue + '∩';
  168.           'ɀ': FullValue := FullValue + '≡';
  169.           'Ɂ': FullValue := FullValue + '±';
  170.           'ɂ': FullValue := FullValue + '≥';
  171.           'Ƀ': FullValue := FullValue + '≤';
  172.           'Ʉ': FullValue := FullValue + '⌠';
  173.           'Ʌ': FullValue := FullValue + '⌡';
  174.           'Ɇ': FullValue := FullValue + '÷';
  175.           'ɇ': FullValue := FullValue + '≈';
  176.           'Ɉ': FullValue := FullValue + '°';
  177.           'ɉ': FullValue := FullValue + '∙';
  178.           'ɐ': FullValue := FullValue + '·';
  179.           'ɑ': FullValue := FullValue + '√';
  180.           'ɒ': FullValue := FullValue + 'ⁿ';
  181.           'ɓ': FullValue := FullValue + '²';
  182.           'ɔ': FullValue := FullValue + '■';
  183.           'ɕ': FullValue := FullValue + ' ';
  184.           '&#x%DF;': FullValue := FullValue + '▀';
  185.           '4': FullValue := FullValue + '"';
  186.           '–': FullValue := FullValue + '-';
  187.           '‘': FullValue := FullValue + '"';
  188.           '’': FullValue := FullValue + '"';
  189.           '“': FullValue := FullValue + '"';
  190.           '”': FullValue := FullValue + '"';
  191.           '„': FullValue := FullValue + '"';
  192.           else
  193.             FullValue := FullValue + CharCode;
  194.           end;
  195.         Counter := Counter + 7;
  196.       end;
  197.     until Counter > Length(Value);
  198.     HTMLDecode(FullValue);
  199.     Value := FullValue;
  200.     end
  201.   end;
  202.  
  203. procedure AnalyzePage();
  204.   var
  205.   Page: TStringList;
  206.   pozycja, startPos, endPos: integer;
  207.   linia, adres, tytul: string;
  208.   
  209.   begin
  210.   Page := TStringList.Create;
  211.   link := URLEncode('http://www.film.sarnet.pl//?show=szukaj&SID=da2725d4cbff8d2cea3a1d67120aeb5f&word=' + MovieName);
  212.   Page.Text := GetPage(link); 
  213.   pozycja := FindLine('0 znalezionych', Page, 0);
  214.   if pozycja = -1 then
  215.    begin
  216.    pozycja := FindLine('znalezionych', Page, 0);
  217.    if (pozycja >-1) then 
  218.     begin
  219.     PickTreeClear;
  220.     linia := Page.GetString(pozycja);
  221.     startPos := pos('znalezionych', Linia);
  222.     delete(linia, 1, startPos + 11);
  223.     if (pos('[Film]', linia) > 0) then
  224.      begin
  225.      while (pos('[Film]', linia) > 0) do
  226.       begin
  227.        startPos := pos('[Film]', Linia);
  228.        delete(linia, 1, startPos + 5);
  229.        startPos := pos('<a href=', Linia);
  230.        delete(linia, 1, startPos + 7);
  231.        endPos := pos('>', Linia);
  232.        adres := copy(linia, 1, endPos - 1);
  233.        delete(linia, 1, endPos);
  234.         adres := 'http://www.film.sarnet.pl/' + adres;
  235.        endPos := pos('• ', Linia);
  236.        if endPos = 0 then
  237.         begin
  238.         endPos := length(linia);
  239.         tytul := copy(linia, 1, endPos);     
  240.         end
  241.        else
  242.         tytul := copy(linia, 1, endPos - 1);     
  243.          HTMLRemoveTags(tytul);
  244.         DecodeHTML(tytul);
  245.        if pos('Newsy', tytul) > 0 then delete(tytul, pos('Newsy', tytul), length(tytul));
  246.        if pos('Artyku│y', tytul) > 0 then delete(tytul, pos('Artyku│y', tytul), length(tytul));
  247.        if pos('Napisy', tytul) > 0 then delete(tytul, pos('Napisy', tytul), length(tytul));
  248.        PickTreeAdd(tytul, adres);    
  249.       end;
  250.      end
  251.     else
  252.      begin
  253.      DecodeHTML(MovieName);    
  254.      ShowMessage('Nie znaleziono ┐adnego filmu spe│niaj╣cego kryteria: "'+MovieName+'".');
  255.      end;
  256.     end
  257.    else
  258.     begin
  259.     DecodeHTML(MovieName);  
  260.     ShowMessage('Nie znaleziono ┐adnego filmu spe│niaj╣cego kryteria: "'+MovieName+'".');
  261.     end;
  262.    end
  263.   else
  264.    begin
  265.    DecodeHTML(MovieName);
  266.    ShowMessage('Nie znaleziono ┐adnego filmu spe│niaj╣cego kryteria: "'+MovieName+'".');
  267.    end;
  268.    if PickTreeExec(adres) then
  269.     begin
  270.     Page.Text := GetPage(adres);
  271.     link := adres;
  272.     AnalyzeMoviePage(page);
  273.     end;
  274.   Page.Free;
  275.   end;
  276.  
  277. procedure AnalyzeMoviePage(Page: TStringList);
  278.   var
  279.   Linia, tytul, line, Obsada, OrgLine: string;
  280.   LineNr, licznik: Integer;
  281.   StartPos, EndPos, i: Integer;
  282.   begin
  283.  
  284.   if cover = false then
  285.   begin 
  286.   // Tytu│ polski i oryginalny
  287.   pozycja := FindLine('Szukaj:', Page, 0);
  288.   pozycja := pozycja + 1;
  289.   repeat
  290.    begin
  291.    linia := Page.GetString(pozycja);
  292.    HTMLRemoveTags(linia);
  293.    DecodeHTML(linia);
  294.    while ((copy(linia, 1, 1) = '    ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
  295.    if (linia = '') then pozycja := pozycja +1;
  296.    end;
  297.   until (linia <> ''); 
  298.   startPos := pos('(', linia);
  299.   endPos := pos(')', linia);
  300.   if ((startPos = 0) and (endPos = 0)) then
  301.    begin
  302.    tytul := copy(linia, 1, length(linia));
  303.    while ((copy(tytul, 1, 1) = '    ') or (copy(tytul, 1, 1) = ' ')) do delete(tytul, 1, 1);
  304.    while ((copy(tytul, length(tytul), 1) = '    ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul,  length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1);
  305.    setField(fieldTranslatedTitle, tytul);
  306.    setField(fieldOriginalTitle, tytul);
  307.    end
  308.   else
  309.    begin  
  310.    tytul := copy(linia, 1, startPos - 1);
  311.    while ((copy(tytul, 1, 1) = '    ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1);
  312.    while ((copy(tytul, length(tytul), 1) = '    ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul,  length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1);
  313.    setField(fieldTranslatedTitle, tytul);
  314.    tytul := copy(linia, startPos + 1, endPos - startPos - 1);
  315.    while ((copy(tytul, 1, 1) = '    ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1);
  316.    while ((copy(tytul, length(tytul), 1) = '    ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul,  length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1);
  317.    setField(fieldOriginalTitle, tytul);
  318.    end;
  319.   
  320.   // Opis filmu
  321.   tytul := '';
  322.   pozycja := pozycja + 1;
  323.   repeat
  324.    begin
  325.    linia := Page.GetString(pozycja);
  326.    HTMLRemoveTags(linia);
  327.    while ((copy(linia, 1, 1) = '    ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
  328.    DecodeHTML(linia); 
  329.    if (linia = '') then pozycja := pozycja +1;
  330.    end;
  331.   until (linia <> ''); 
  332.   pozycja2 := FindLine('ocena:', Page, 0);
  333.   repeat
  334.    begin
  335.    linia := Page.GetString(pozycja);
  336.    while ((copy(linia, 1, 1) = '    ') or (copy(linia, 1, 1) = ' ') or (copy(linia , 1, 1) = 'á')) do delete(linia, 1, 1);   
  337.    if (linia = '') then
  338.     begin
  339.     pozycja := pozycja + 1;
  340.     linia := Page.GetString(pozycja);
  341.     end;
  342.    pozycja3 := pos('<a href="mailto:', linia);
  343.    if pozycja3 > 0 then 
  344.     begin
  345.     pozycja := pozycja2;
  346.     delete(linia, pozycja3, length(linia));
  347.     end;
  348.    pozycja3 := pos('<strong>', linia);
  349.    if pozycja3 > 0 then 
  350.     begin
  351.     pozycja := pozycja2;
  352.     delete(linia, pozycja3, length(linia));
  353.     end;
  354.    HTMLRemoveTags(linia);
  355.    DecodeHTML(linia);
  356.    while ((copy(linia, 1, 1) = '    ') or (copy(linia, 1, 1) = ' ') or (copy(linia, 1, 1) = 'á')) do delete(linia, 1, 1);
  357.    while ((copy(linia, length(linia), 1) = '    ') or (copy(linia, length(linia), 1) = ' ') or (copy(linia, length(linia), 1) = 'á')) do delete(linia, length(linia), 1);  
  358.    tytul := tytul + linia;
  359.    pozycja := pozycja + 1;
  360.    end;
  361.   until (pozycja >= pozycja2);
  362.   while ((copy(tytul, 1, 1) = '    ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1);
  363.   while ((copy(tytul, length(tytul), 1) = '    ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul,  length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1);
  364.   if (tytul <> '') then setField(fieldDescription, tytul);
  365.  
  366.   //ocena
  367.   pozycja := FindLine('ocena:', Page, 0);
  368.   if pozycja > -1 then
  369.    begin
  370.    linia := Page.GetString(pozycja);
  371.    HTMLRemoveTags(linia);
  372.    DecodeHTML(linia);  
  373.    startPos := pos('ocena:', linia);
  374.    tytul := copy(linia, startPos + 6, length(linia) - startPos - 6);
  375.    endPos := pos('.', tytul);
  376.    tytul := copy(tytul, 1, endPos - 1);
  377.    setField(fieldRating, tytul);
  378.    end;
  379.   
  380.   //Re┐yser
  381.   pozycja := FindLine('Re┐yseria:', Page, 0);
  382.   if pozycja > -1 then
  383.    begin  
  384.    linia := Page.GetString(pozycja);
  385.    HTMLRemoveTags(linia);
  386.    DecodeHTML(linia);  
  387.    startPos := pos('Re┐yseria:', linia);
  388.    delete(linia, 1, startPos + 9);
  389.    tytul := copy(linia, 1, length(linia));
  390.    if copy(tytul, length(tytul), 1) = ' ' then delete(tytul, length(tytul), 1);
  391.    if copy(tytul, 1, 1) = ' ' then delete(tytul, 1, 1);
  392.    setField(fieldDirector, tytul);
  393.    end;
  394.   
  395.    //Producent
  396.   pozycja := -1;
  397.   pozycja := FindLine('Producent:', Page, 0);
  398.   if pozycja = -1 then pozycja := FindLine('Dystrybutor:', Page, 0);
  399.   if pozycja > -1 then
  400.    begin
  401.    linia := Page.GetString(pozycja);
  402.    HTMLRemoveTags(linia);
  403.    DecodeHTML(linia);  
  404.    startPos := pos('Producent:', linia);
  405.    if startPos > 0 then
  406.     begin
  407.     delete(linia, 1, startPos + 9);
  408.     endPos := pos('Scenografia:', linia);
  409.     if endPos = 0 then endPos := pos('Muzyka:', linia);
  410.     tytul := copy(linia, 1, endPos - 1);
  411.     end
  412.    else
  413.     begin
  414.     startPos := pos('Dystrybutor:', linia);
  415.     delete(linia, 1, startPos + 11);
  416.     tytul := copy(linia, 1, length(linia));
  417.     end;    
  418.    if copy(tytul, length(tytul), 1) = ' ' then delete(tytul, length(tytul), 1);
  419.    if copy(tytul, 1, 1) = ' ' then delete(tytul, 1, 1);
  420.    setField(fieldProducer, tytul);
  421.    end;
  422.   
  423.   // Rok produkcji
  424.   pozycja := FindLine('Data produkcji:', Page, 0);
  425.   if pozycja > -1 then
  426.    begin
  427.    linia := Page.GetString(pozycja);
  428.    HTMLRemoveTags(linia);
  429.    DecodeHTML(linia);  
  430.    startPos := pos('Data produkcji:', linia);
  431.    delete(linia, 1, startPos + 14);
  432.    tytul := copy(linia, 1, length(linia));
  433.    if copy(tytul, length(tytul), 1) = ' ' then delete(tytul, length(tytul), 1);
  434.    if copy(tytul, 1, 1) = ' ' then delete(tytul, 1, 1);
  435.    setField(fieldYear, tytul);
  436.    end;
  437.  
  438.   // Czas trwania
  439.   pozycja := FindLine('Czas trwania:', Page, 0);
  440.   if pozycja > -1 then
  441.    begin
  442.    linia := Page.GetString(pozycja);
  443.    HTMLRemoveTags(linia);
  444.    DecodeHTML(linia);  
  445.    startPos := pos('Czas trwania:', linia);
  446.    delete(linia, 1, startPos + 12);
  447.    endPos := pos('min.', linia);
  448.    if endPos > 0 then
  449.     begin
  450.     tytul := copy(linia, 1, endPos - 1);
  451.     end
  452.    else
  453.     begin
  454.     endPos := pos('Od lat:', linia);
  455.     tytul := copy(linia, 1, endPos - 1);
  456.     end;
  457.    while ((copy(tytul, 1, 1) = '    ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1);
  458.    while ((copy(tytul, length(tytul), 1) = '    ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul, length(tytul), 1) = 'á')) do delete(tytul, length(tytul), 1); 
  459.    setField(fieldLength, tytul); 
  460.    end;
  461.   
  462.   //kraj
  463.   pozycja := FindLine('Produkcja:', Page, 0);
  464.   if pozycja > -1 then
  465.    begin
  466.    linia := Page.GetString(pozycja);
  467.    HTMLRemoveTags(linia);
  468.    DecodeHTML(linia);  
  469.    startPos := pos('Produkcja:', linia);
  470.    delete(linia, 1, startPos + 9);
  471.    tytul := copy(linia, 1, length(linia));
  472.    if copy(tytul, length(tytul), 1) = ' ' then delete(tytul, length(tytul), 1);
  473.    if copy(tytul, 1, 1) = ' ' then delete(tytul, 1, 1);
  474.    setField(fieldCountry, tytul);   
  475.    end;
  476.   
  477.   // Gatunek
  478.   pozycja := FindLine('Gatunek:', Page, 0);
  479.   if pozycja > -1 then
  480.    begin
  481.    linia := Page.GetString(pozycja);
  482.    HTMLRemoveTags(linia);
  483.    DecodeHTML(linia);  
  484.    startPos := pos('Gatunek:', linia);
  485.    delete(linia, 1, startPos + 7);
  486.    endPos := pos('Dystrybutor:', linia) - 1;
  487.    if endPos = 0 then endPos := length(linia);
  488.    tytul := copy(linia, 1, endPos);
  489.    if copy(tytul, length(tytul), 1) = ' ' then delete(tytul, length(tytul), 1);
  490.    if copy(tytul, 1, 1) = ' ' then delete(tytul, 1, 1);
  491.    setField(fieldCategory, tytul);   
  492.    end;  
  493.   
  494.   //URL
  495.   setField(fieldURL, link); 
  496.  
  497.   //Obsada
  498.   pozycja := FindLine('W rolach g│≤wnych', Page, 0);
  499.   if pozycja > -1 then
  500.    begin
  501.    linia := Page.GetString(pozycja + 1);
  502.    endPos := pos('REKLAMA', linia) - 1;
  503.    if endPos < 1 then endPos := length(linia);
  504.    tytul := copy(linia, 1, endPos);
  505.    endPos := pos('<td>', tytul);
  506.    delete(tytul, 1, endPos + 3);
  507.    tytul := StringReplace(tytul, '</strong>', '');
  508.    tytul := StringReplace(tytul, '<br><strong>', ',' + #13#10);
  509.    HTMLRemoveTags(tytul);
  510.    DecodeHTML(tytul);     
  511.    while ((copy(tytul, 1, 1) = '    ') or (copy(tytul, 1, 1) = ' ') or (copy(tytul, 1, 1) = 'á')) do delete(tytul, 1, 1); 
  512.    while ((copy(tytul, length(tytul), 1) = '    ') or (copy(tytul, length(tytul), 1) = ' ') or (copy(tytul,  length(tytul), 1) = 'á') or (copy(tytul, length(tytul), 1) = ',')) do delete(tytul, length(tytul), 1);   
  513.    setField(fieldActors, tytul);   
  514.    end;  
  515.   end;
  516.  
  517.   //Foto 
  518.   if (nocover = false) then
  519.    begin 
  520.    pozycja := FindLine('Opcja dostΩpna dla zarejestrownych', Page, 0);
  521.    if pozycja > -1 then
  522.     begin
  523.     linia := Page.GetString(pozycja + 1);  
  524.     startPos := pos('.jpg', linia);
  525.     delete(linia, startPos + 4, length(linia));
  526.     licznik := length(linia); 
  527.     while (copy(linia, licznik, 1) <> ',') do licznik := licznik - 1;
  528.     startPos := licznik + 2;
  529.     tytul := copy(linia, startPos, length(linia));
  530.     if copy(tytul, length(tytul), 1) = ' ' then delete(tytul, length(tytul), 1);
  531.     if copy(tytul, 1, 1) = ' ' then delete(tytul, 1, 1);   
  532.     tytul := 'http://www.film.sarnet.pl/' + 'images/film/plakat/' + tytul;
  533.     tytul := URLEncode(tytul);
  534.     GetPicture(tytul);  
  535.     end;
  536.    end;   
  537.   
  538.   //DisplayResults;
  539.   end;
  540.  
  541. begin
  542.   if CheckVersion(3,5,0) then
  543.     begin
  544.     MovieName := GetField(fieldTranslatedTitle);
  545.     if MovieName = '' then MovieName := GetField(fieldOriginalTitle);
  546.     if Input('Megfilm Import', 'Podaj tytu│ filmu:', MovieName) then
  547.       begin
  548.       // Zamiana na ISO-8859-2
  549.       MovieName:=StringReplace(MovieName, '╣', chr(177));
  550.       MovieName:=StringReplace(MovieName, 'µ', chr(230));
  551.       MovieName:=StringReplace(MovieName, 'Ω', chr(234));
  552.       MovieName:=StringReplace(MovieName, '│', chr(179));
  553.       MovieName:=StringReplace(MovieName, '±', chr(241));
  554.       MovieName:=StringReplace(MovieName, '≤', chr(243));
  555.       MovieName:=StringReplace(MovieName, '£', chr(182));
  556.       MovieName:=StringReplace(MovieName, 'ƒ', chr(188));
  557.       MovieName:=StringReplace(MovieName, '┐', chr(191));
  558.       MovieName:=StringReplace(MovieName, 'Ñ', chr(161));
  559.       MovieName:=StringReplace(MovieName, '╞', chr(198));
  560.       MovieName:=StringReplace(MovieName, '╩', chr(202));
  561.       MovieName:=StringReplace(MovieName, 'ú', chr(163));
  562.       MovieName:=StringReplace(MovieName, '╤', chr(209));
  563.       MovieName:=StringReplace(MovieName, '╙', chr(211));
  564.       MovieName:=StringReplace(MovieName, 'î', chr(166));
  565.       MovieName:=StringReplace(MovieName, 'Å', chr(172));
  566.       MovieName:=StringReplace(MovieName, '»', chr(175));
  567.       pozycja := pos('/cover/', MovieName); 
  568.       if pozycja > 0 then
  569.        begin
  570.        MovieName := StringReplace(MovieName, '/cover/' , '');
  571.        cover := true;
  572.        end    
  573.       else cover := false;
  574.       pozycja := pos('/nocover/', MovieName); 
  575.       if pozycja > 0 then
  576.        begin
  577.        MovieName := StringReplace(MovieName, '/nocover/' , '');
  578.        nocover := true;
  579.        end    
  580.       else nocover := false;      
  581.       while (copy(MovieName, length(MovieName), 1) = ' ') do delete(MovieName, length(MovieName), 1); 
  582.       while (copy(MovieName, 1, 1) = ' ') do delete(MovieName, 1, 1); 
  583.       AnalyzePage();
  584.       end;
  585.     end
  586.   else
  587.     ShowMessage('Skrypt wymaga programu Ant Movie Catalog w wersji 3.5.0 lub nowszej');
  588. end.
  589.